package com.itheima.Demo01.demo05;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class TestCallable05 {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        MyCallable05 M1 = new MyCallable05();
        FutureTask<String> ft1 = new FutureTask<>(M1);
        Thread T1 = new Thread(ft1);
        T1.setName("第一个窗口");
        T1.start();

        FutureTask<String> ft2 = new FutureTask<>(M1);
        Thread T2 = new Thread(ft2);
        T2.setName("第二个窗口");
        T2.start();


        FutureTask<String> ft3 = new FutureTask<>(M1);
        Thread T3 = new Thread(ft3);
        T3.setName("第三个窗口");
        T3.start();

        String s1 = ft1.get();
        String s2 = ft2.get();
        String s3 = ft3.get();
        System.out.println(T1.getName()+s1);
        System.out.println(T2.getName()+s2);
        System.out.println(T3.getName()+s3);

    }
}
